/**
 * reducer 纯函数
 *
 */
export const CollapsedReducer= (prevState={isCollapsed: false}, action)=>{
    // console.log(action);

    const { type }= action;
    switch (type) {
        case 'change_collapsed':
            let newState= {...prevState};
            newState.isCollapsed= !newState.isCollapsed;
            return newState;

        default:
            return prevState;
    }
}

export const LoadingReducer= (prevState={isLoading: false}, action)=>{
    // console.log(action);

    const { type, payload }= action;
    switch (type) {
        case 'change_loading':
            let newState= {...prevState};
            newState.isLoading= payload;
            return newState;

        default:
            return prevState;
    }
}
